package com.czy.owner.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.czy.owner.R;
import com.czy.owner.entity.LogisticsModel;
import com.easyrecycleview.adapter.BaseViewHolder;
import com.easyrecycleview.adapter.RecyclerArrayAdapter;


/**
 * Created by wangyang on 2017/4/20 0020.
 */
public class LogisticsSubAdapter extends RecyclerArrayAdapter<LogisticsModel.TracesBean> {

    private Context context;

    public LogisticsSubAdapter(Context context) {
        super(context);
        this.context = context;
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new LogisticsSubAdapter.LogisticsSubViewHolder(parent);

    }

    class LogisticsSubViewHolder extends BaseViewHolder<LogisticsModel.TracesBean> {
        private View viewXian;
        private TextView tvAcceptStation;
        private TextView tvAcceptTime;

        public LogisticsSubViewHolder(ViewGroup parent) {
            super(parent, R.layout.item_sub_logistics);
            viewXian = $(R.id.view_xian);
            tvAcceptStation = $(R.id.tv_accept_station);
            tvAcceptTime = $(R.id.tv_accept_time);

        }

        @Override
        public void setData(LogisticsModel.TracesBean data) {
            tvAcceptStation.setText(data.getAcceptStation());
            tvAcceptTime.setText(data.getAcceptTime());
            if(getCount()==getDataPosition()+1){
                viewXian.setVisibility(View.GONE);
            }else {
                viewXian.setVisibility(View.VISIBLE);
            }

        }

    }
}
